package Duoxiancheng;


import java.util.concurrent.*;

public class FutureDemo {
    static FutureTask<String> tasks = new FutureTask<>(new Callable<String>() {
        @Override
        public String call() throws Exception {
            return "b";
        }
    });
    static ExecutorService threadPool = Executors.newFixedThreadPool(10);

    public static void main(String[] args) throws ExecutionException, InterruptedException {
//        Future r = threadPool.submit(new Callable<String>() {
//
//            @Override
//            public String call() throws Exception {
//                return "g";
//            }
//        });
//        System.out.println("main");
        Future r = threadPool.submit(tasks);
        String s = (String) r.get();
        System.out.println(s);


    }
}
